package tts.controller.roles;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;

import tts.controller.RedirectAction;
import tts.dao.RolesHome;
import tts.model.Roles;

public class List extends RedirectAction {

	//fields
	private static final long serialVersionUID = -86966939953569102L;
	@Autowired
	private RolesHome rolesHome;
	private Collection<Roles> rolesList;

	//get & set
	public Collection<Roles> getRolesList() {
		return rolesList;
	}
	public void setRolesList(Collection<Roles> rolesList) {
		this.rolesList = rolesList;
	}

	//methods
	public void list() {
		try {
			this.rolesList=rolesHome.findAll();
			this.getServletRequest().setAttribute("rolesList", rolesList);
		} catch (RuntimeException e) {
			addActionError(e.getMessage());
		}
	}	
}